package com.javafive;

import java.io.*;

public class Demo14 {
    public static void main(String[] args)  throws  Exception{
        //
        String path="E:\\备课笔记\\Kgc备课\\Java全部的课程\\03-Java高级API\\6.输入和输出处理（二）\\01-教学PPT\\1.jpg";
        String path1="E:\\备课笔记\\Kgc备课\\Java全部的课程\\03-Java高级API\\6.输入和输出处理（二）\\01-教学PPT\\2.jpg";
        File file = new File(path);

        InputStream inputStream = new FileInputStream(file);
        DataInputStream d =new DataInputStream(inputStream);
        int cum=-1;
        byte[] bytes = new byte[inputStream.available()];
        while ((cum=d.read(bytes))!=-1){
        }
        File file1 = new File(path1);
        OutputStream outputStream = new FileOutputStream(file1);
        DataOutputStream dataOutputStream = new DataOutputStream(outputStream);
        dataOutputStream.flush();
        dataOutputStream.write(bytes);

        outputStream.close();
        dataOutputStream.close();
        d.close();
        inputStream.close();
    }
}
